import React, { Component } from 'react';
import LifeChild from './LifeChild'
class Life extends Component {
    state = {  
        count:0
    } 
    componentDidMount(){
        console.log('componentDidMount-render之后真是dom已经挂载完成');
        console.log(document.getElementById('demo'));
    }
    componentDidUpdate(){
        console.log('DidUpdate数据更新');
    }
    componentWillUnmount(){
        console.log('组件正在卸载')
    }
    render() { 
        return (<>
        componentWillMount <br />
        <div id='demo'>demo</div>
        <button onClick={()=>{
            this.setState({
                count:this.state.count+1
            })
        }}>更新count</button>
        <LifeChild count={this.state.count}/>
        </>);
    }
}
 
export default Life;